


async function login(name,pwd){
    const p = await myPromiseJQueryAjax('../server/goods_login.php','post',{userName:name,userPwd:pwd},'json');
    console.log(p);
    if(p.code === 0){
        $('[name="msg"]').html( '您输入的账号密码有误 登录失败' ).css({color:'red'});
    }else if(p.code === 1){
        mySetCookie('login' , 1 , 7*24*60*60 , '/' );
        let num = 5 ;

          $('[name="msg"]').html( `恭喜您 登录成功 ${num}秒后 跳转 首页面` ).css({color:'blue'});

          let time = setInterval( function(){
            num--;
          $('[name="msg"]').html( `恭喜您 登录成功 ${num}秒后 跳转 首页面` ).css({color:'blue'});

            if( num === 1 ){
              // 清除定时器
              clearInterval( time );

              // 跳转首页面
              window.location.href = './index.html';
            }
          } , 1000 );
    }

}